<?php
require dirname(__FILE__) . '/../../../../auto_load.php';
class PdoMysqlEngineTest extends PHPUnit_Framework_TestCase
{
	private $db_config;
	private $pdo_mysql_engine;
	
	public function setUp()
	{
		$this->db_config = ConfigParser::get('db','db_servers[\'mysql\']');
		$this->pdo_mysql_engine = new PdoMysqlEngine($this->db_config);
	}
	
	
	public function testDelete()
	{
		$table_name = 'dtd';
		
		$result = $this->pdo_mysql_engine->delete($table_name);
		var_dump($result);
	}
	
	public function testInsertRow()
	{
		$table_name = 'dtd';
		$data = array(
			'value' => 'html5'
		);
		$result = $this->pdo_mysql_engine->insertRow($table_name,$data);
		var_dump($result);
	}
	
	public function testInsertRows()
	{
		$table_name = 'dtd';
		$data = array(
			array(
				'value' => 'html5'
			),
			array(
				'value' => 'xhtml_1.0_transitional'
			)
		);
		$result = $this->pdo_mysql_engine->insertRows($table_name,$data);
		var_dump($result);
	}
	public function testSelectCount()
	{
		$table_name = 'dtd';
		//$where = array('id'=>1);
		$result = $this->pdo_mysql_engine->selectCount($table_name);
		var_dump($result);
	}
	
	public function testSelectRow()
	{
		$table_name = 'dtd';
		$where = array('id'=>1);
		$result = $this->pdo_mysql_engine->selectRow($table_name,$where);
		var_dump($result);
	}
	
	public function testSelectRows()
	{
		$table_name = 'dtd';
		$result = $this->pdo_mysql_engine->selectRows($table_name);
		var_dump($result);
	}
	
	public function testUpdate()
	{
		$table_name = 'dtd';
		$where = array('id'=>1);
		$data = array(
			'value' => 'asdf'
		);
		$result = $this->pdo_mysql_engine->update($table_name,$where,$data);
		var_dump($result);
	}
}
?>